<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./js/vue.js"></script>
<body>
    <div class="box">

    </div>
    <script>
    // 需求：yangyang is a boy  变为大写
        // 全局过滤器
        Vue.filter('yangyang',(value)=>{
            console.log(value);
            return value.toUpperCase();
        })
    
        // 过滤器分为两类：局部过滤器   全局过滤器
        const vm = new Vue({
            el:'.box',
            data:{
                msg:'yangyang is a boy?'
            },
            // 局部过滤器
            filters:{
                upper(value){
                    // console.log(value);
                    value = value.toUpperCase();
                    return value
                },
                // 想让首字符大写
                firstUpper(value){
                    console.log('=========')
                    console.log(value)
                    value = value.toLowerCase();
                    console.log(value);
                    console.log(value.charAt(0).toUpperCase());
                    console.log(value.slice(1));
                    return value.charAt(0).toUpperCase() + value.slice(1)
                }
            }
        })
        const vm1 = new Vue({
            el:'.box1',
            data:{
                msg:'ghoierjgioerhgoierjo'
            }
        })
    </script>
</body>
</html>